#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <signal.h>
#include <sys/time.h>

int main()
{
   struct itimerval new_val;
   // 设置第一次触发的时间
   new_val.it_value.tv_sec = 2;
   new_val.it_value.tv_usec = 0;
   // 设置周期性触发的时间
   new_val.it_interval.tv_usec = 0;
   new_val.it_interval.tv_sec = 2;

   // 倒计时2s
   setitimer(ITIMER_REAL, &new_val, NULL);
   while(1)
   {
       printf("hello world\n");
       sleep(1);
   }
   return 0;
}
